﻿using System.Web.Mvc;
using Sub.TaskPlanningDesk.Model.Services.Projects;
using Sub.TaskPlanningDesk.WebSite.ViewModels.Projects;
using Sub.TaskPlanningDesk.WebSite.Infrastructure;

namespace Sub.TaskPlanningDesk.WebSite.Controllers
{
	public class ProjectController : Controller
	{
		#region ctor

		private IProjectService _projectService;
		private ITaskService _taskService;

		public ProjectController(IProjectService projectService, ITaskService taskService)
		{
			_projectService = projectService;
			_taskService = taskService;
		}

		#endregion

		[ActionName("TaskList")]
		public ActionResult GetTasks(int projectID, bool showUnCompleted = false)
		{
			var tasks = _taskService.GetTasks(projectID, showUnCompleted);
			var project = _projectService.ByID(projectID);
			ProjectModel model = new ProjectModel(project, tasks);
			return View(TheViews.Project.TaskList, model);
		}

		
	}
}
